#include "../include/Entite.h"

/** @brief (one liner)
  *
  * (documentation goes here)
  */

/**
*	Fonctionsde carracteristiques entité
*/
CarracteristiquesEntite::CarracteristiquesEntite( int _vitesse, int _vieMax, int _pointForce, float _tpsConstruction, Ressource _cout) : CarracteristiquesElement(_vieMax, _cout)
{
	setVitesse(_vitesse);
	pointForce = _pointForce;
	tempsConstruction =  _tpsConstruction;
	getVitesse();
}

int CarracteristiquesEntite::getVitesse() const
{
	return vitesse;
}

int CarracteristiquesEntite::getPointForce() const
{
	return pointForce;
}

float CarracteristiquesEntite::getTempsConstruction() const
{
	return tempsConstruction;
}

void CarracteristiquesEntite::setVitesse(int v)
{
	vitesse = v;
}

void CarracteristiquesEntite::setPointForce(int p)
{
	pointForce = p;
}

void CarracteristiquesEntite::setTpsConstruction(float t)
{
	tempsConstruction = t;
}


/**********************************************************
*	Fonctions de Entite
*/



Entite::Entite( int ID_Owner,CarracteristiquesEntite *_c) : Element( ID_Owner,_c)
{
    c = _c;
    occupation = NULL;
}

/** @brief (one liner)
  *
  * (documentation goes here)
  */
void Entite::taper(Element& el)
{
    el.subir( c->getPointForce());
}

float Entite::getTempsConstruction() const
{
    return c->getTempsConstruction();
}

void Entite::lancerOccupation()
{
	if( occupation != NULL )
	{
		occupation->executer();
		if( occupation->estFini() )
		{
			delete occupation;	
			occupation = NULL;
		}
	}
}

void Entite::definirOccupation( Occupation *occ)
{
	occupation = occ;
}

int Entite::getVitesse()
{
	return c->getVitesse();
}
